repo: Report metadata fetch progress separately
authorMatthew Barnes <mbarnes@redhat.com>
Thu, 8 Jan 2015 19:43:01 +0000 (14:43 -0500)
committerMatthew Barnes <mbarnes@redhat.com>
Mon, 12 Jan 2015 16:21:18 +0000 (11:21 -0500)
Partially resolves https://bugzilla.gnome.org/740276

src/libostree/ostree-repo-pull.c
src/libostree/ostree-repo.c

index efe87f6720c4661dc3a34714641dd7a4366bb4c2..2a302ba91d8a94b8a6c3bc8ac286e69eef0c4136 100644 (file)
@@ -189,6 +189,10 @@ update_progress (gpointer user_data)
   ostree_async_progress_set_uint64 (pull_data->progress, "bytes-transferred", bytes_transferred);
   ostree_async_progress_set_uint64 (pull_data->progress, "start-time", start_time);
 
+  /* We fetch metadata before content.  These allow us to report metadata fetch progress specifically. */
+  ostree_async_progress_set_uint (pull_data->progress, "outstanding-metadata-fetches", pull_data->n_outstanding_metadata_fetches);
+  ostree_async_progress_set_uint (pull_data->progress, "metadata-fetched", pull_data->n_fetched_metadata);
+
   if (pull_data->fetching_sync_uri)
     {
       gs_free char *uri_string = soup_uri_to_string (pull_data->fetching_sync_uri, TRUE);
index aa6939a6778a27be931b1b85b3dd80bb643b1844..942c24adb868acb91f9306fc24aa4ac7f43cfee4 100644 (file)
@@ -2748,6 +2748,7 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress
   GString *buf;
   gs_free char *status = NULL;
   guint outstanding_fetches;
+  guint outstanding_metadata_fetches;
   guint outstanding_writes;
   guint n_scanned_metadata;
 
@@ -2758,6 +2759,7 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress
 
   status = ostree_async_progress_get_status (progress);
   outstanding_fetches = ostree_async_progress_get_uint (progress, "outstanding-fetches");
+  outstanding_metadata_fetches = ostree_async_progress_get_uint (progress, "outstanding-metadata-fetches");
   outstanding_writes = ostree_async_progress_get_uint (progress, "outstanding-writes");
   n_scanned_metadata = ostree_async_progress_get_uint (progress, "scanned-metadata");
   if (status)
@@ -2768,6 +2770,7 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress
     {
       guint64 bytes_transferred = ostree_async_progress_get_uint64 (progress, "bytes-transferred");
       guint fetched = ostree_async_progress_get_uint (progress, "fetched");
+      guint metadata_fetched = ostree_async_progress_get_uint (progress, "metadata-fetched");
       guint requested = ostree_async_progress_get_uint (progress, "requested");
       guint64 bytes_sec = (g_get_monotonic_time () - ostree_async_progress_get_uint64 (progress, "start-time")) / G_USEC_PER_SEC;
       gs_free char *formatted_bytes_transferred =
@@ -2782,9 +2785,17 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress
           formatted_bytes_sec = g_format_size (bytes_sec);
         }
 
-      g_string_append_printf (buf, "Receiving objects: %u%% (%u/%u) %s/s %s",
-                              (guint)((((double)fetched) / requested) * 100),
-                              fetched, requested, formatted_bytes_sec, formatted_bytes_transferred);
+      if (outstanding_metadata_fetches)
+        {
+          g_string_append_printf (buf, "Receiving metadata objects: %u/(estimating) %s/s %s",
+                                  metadata_fetched, formatted_bytes_sec, formatted_bytes_transferred);
+        }
+      else
+        {
+          g_string_append_printf (buf, "Receiving objects: %u%% (%u/%u) %s/s %s",
+                                  (guint)((((double)fetched) / requested) * 100),
+                                  fetched, requested, formatted_bytes_sec, formatted_bytes_transferred);
+        }
     }
   else if (outstanding_writes)
     {